home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / gtksourceview-2.0 / language-specs / csharp.lang < prev    next >
Extensible Markup Language  |  2009-10-02  |  9KB  |  281 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: John Luke <jluke@cfl.rr.com>
  5.  Copyright (C) 2003 John Luke <jluke@cfl.rr.com>
  6.  Copyright (C) 2004 Jeroen Zwartepoorte <jeroen@xs4all.nl>
  7.  Copyright (C) 2004 Alessio Frusciante <algol@firenze.linux.it>
  8.  Copyright (C) 2005 Brion Vibber <brion@pobox.com>
  9.  
  10.  This library is free software; you can redistribute it and/or
  11.  modify it under the terms of the GNU Library General Public
  12.  License as published by the Free Software Foundation; either
  13.  version 2 of the License, or (at your option) any later version.
  14.  
  15.  This library is distributed in the hope that it will be useful,
  16.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  Library General Public License for more details.
  19.  
  20.  You should have received a copy of the GNU Library General Public
  21.  License along with this library; if not, write to the
  22.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  23.  Boston, MA 02111-1307, USA.
  24.  
  25. -->
  26. <language id="c-sharp" _name="C#" version="2.0" _section="Sources">
  27.   <metadata>
  28.     <property name="mimetypes">text/x-csharpsrc;text/x-csharp</property>
  29.     <property name="globs">*.cs</property>
  30.     <property name="line-comment-start">//</property>
  31.     <property name="block-comment-start">/*</property>
  32.     <property name="block-comment-end">*/</property>
  33.   </metadata>
  34.  
  35.   <styles>
  36.     <style id="comment" _name="Comment" map-to="def:comment"/>
  37.     <style id="error" _name="Error" map-to="def:error"/>
  38.     <style id="type" _name="Data Type" map-to="def:type"/>
  39.     <style id="string" _name="String" map-to="def:string"/>
  40.     <style id="char" _name="Character" map-to="def:character"/>
  41.     <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
  42.     <style id="format" _name="String Format" map-to="def:special-char"/>
  43.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  44.     <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
  45.     <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
  46.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  47.     <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
  48.     <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
  49.     <style id="real" _name="Real number" map-to="def:floating-point"/>
  50.   </styles>
  51.  
  52.   <definitions>
  53.  
  54.     <context id="line-comment" style-ref="comment" end-at-line-end="true">
  55.       <start>//</start>
  56.       <include>
  57.         <context ref="def:in-line-comment"/>
  58.       </include>
  59.     </context>
  60.  
  61.     <context id="multiline-comment" style-ref="comment">
  62.       <start>/\*</start>
  63.       <end>\*/</end>
  64.       <include>
  65.         <context ref="def:in-comment"/>
  66.       </include>
  67.     </context>
  68.  
  69.     <context id="close-comment-outside-comment" style-ref="error">
  70.       <match>\*/(?!\*)</match>
  71.     </context>
  72.  
  73.     <define-regex id="preproc-start">^\s*#\s*</define-regex>
  74.  
  75.     <context id="if-false-comment" style-ref="comment">
  76.       <start>\%{preproc-start}if\s*false\b</start>
  77.       <end>\%{preproc-start}(endif|else|elif)\b</end>
  78.       <include>
  79.         <context id="if-in-if-false">
  80.           <start>\%{preproc-start}if(n?def)?\b</start>
  81.           <end>\%{preproc-start}endif\b</end>
  82.           <include>
  83.             <context ref="if-in-if-false"/>
  84.             <context ref="def:in-comment"/>
  85.           </include>
  86.         </context>
  87.         <context ref="def:in-comment"/>
  88.       </include>
  89.     </context>
  90.  
  91.     <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
  92.       <start extended="true">
  93.         \%{preproc-start}
  94.         (define|undef|if(n?def)?|else|elif|endif|line|error|warning|region|endregion)
  95.         \b
  96.       </start>
  97.       <include>
  98.         <context ref="line-comment"/>
  99.         <context ref="multiline-comment"/>
  100.       </include>
  101.     </context>
  102.  
  103.     <context id="multiline-string" style-ref="string">
  104.       <start>@"</start>
  105.       <end>"</end>
  106.     </context>
  107.  
  108.     <context id="keywords" style-ref="keyword">
  109.       <keyword>class</keyword>
  110.       <keyword>delegate</keyword>
  111.       <keyword>enum</keyword>
  112.       <keyword>event</keyword>
  113.       <keyword>interface</keyword>
  114.       <keyword>namespace</keyword>
  115.       <keyword>struct</keyword>
  116.       <keyword>using</keyword>
  117.       <keyword>abstract</keyword>
  118.       <keyword>const</keyword>
  119.       <keyword>explicit</keyword>
  120.       <keyword>extern</keyword>
  121.       <keyword>fixed</keyword>
  122.       <keyword>implicit</keyword>
  123.       <keyword>internal</keyword>
  124.       <keyword>lock</keyword>
  125.       <keyword>out</keyword>
  126.       <keyword>override</keyword>
  127.       <keyword>params</keyword>
  128.       <keyword>partial</keyword>
  129.       <keyword>private</keyword>
  130.       <keyword>protected</keyword>
  131.       <keyword>public</keyword>
  132.       <keyword>ref</keyword>
  133.       <keyword>sealed</keyword>
  134.       <keyword>static</keyword>
  135.       <keyword>readonly</keyword>
  136.       <keyword>unsafe</keyword>
  137.       <keyword>virtual</keyword>
  138.       <keyword>volatile</keyword>
  139.       <keyword>add</keyword>
  140.       <keyword>as</keyword>
  141.       <keyword>assembly</keyword>
  142.       <keyword>base</keyword>
  143.       <keyword>break</keyword>
  144.       <keyword>case</keyword>
  145.       <keyword>catch</keyword>
  146.       <keyword>checked</keyword>
  147.       <keyword>continue</keyword>
  148.       <keyword>default</keyword>
  149.       <keyword>do</keyword>
  150.       <keyword>else</keyword>
  151.       <keyword>finally</keyword>
  152.       <keyword>for</keyword>
  153.       <keyword>foreach</keyword>
  154.       <keyword>get</keyword>
  155.       <keyword>goto</keyword>
  156.       <keyword>if</keyword>
  157.       <keyword>in</keyword>
  158.       <keyword>is</keyword>
  159.       <keyword>new</keyword>
  160.       <keyword>remove</keyword>
  161.       <keyword>return</keyword>
  162.       <keyword>set</keyword>
  163.       <keyword>sizeof</keyword>
  164.       <keyword>stackalloc</keyword>
  165.       <keyword>super</keyword>
  166.       <keyword>switch</keyword>
  167.       <keyword>this</keyword>
  168.       <keyword>throw</keyword>
  169.       <keyword>try</keyword>
  170.       <keyword>typeof</keyword>
  171.       <keyword>unchecked</keyword>
  172.       <keyword>value</keyword>
  173.       <keyword>void</keyword>
  174.       <keyword>while</keyword>
  175.       <keyword>yield</keyword>
  176.     </context>
  177.  
  178.     <context id="primitives" style-ref="type">
  179.       <keyword>bool</keyword>
  180.       <keyword>byte</keyword>
  181.       <keyword>char</keyword>
  182.       <keyword>decimal</keyword>
  183.       <keyword>double</keyword>
  184.       <keyword>float</keyword>
  185.       <keyword>int</keyword>
  186.       <keyword>long</keyword>
  187.       <keyword>object</keyword>
  188.       <keyword>operator</keyword>
  189.       <keyword>sbyte</keyword>
  190.       <keyword>short</keyword>
  191.       <keyword>string</keyword>
  192.       <keyword>uint</keyword>
  193.       <keyword>ulong</keyword>
  194.       <keyword>ushort</keyword>
  195.     </context>
  196.  
  197.     <context id="null-value" style-ref="null-value">
  198.       <keyword>null</keyword>
  199.     </context>
  200.  
  201.     <context id="boolean" style-ref="boolean">
  202.       <keyword>false</keyword>
  203.       <keyword>true</keyword>
  204.     </context>
  205.  
  206.     <context id="decimal" style-ref="decimal">
  207.       <match extended="true">
  208.         (?<![\w\.])
  209.         [0-9]+[uUlL]*
  210.         (?![\w\.])
  211.       </match>
  212.     </context>
  213.  
  214.     <context id="hexadecimal" style-ref="hexadecimal">
  215.       <match extended="true">
  216.         (?<![\w\.])
  217.         0[xX][a-fA-F0-9]+[uUlL]*
  218.         (?![\w\.])
  219.       </match>
  220.     </context>
  221.  
  222.     <context id="real" style-ref="real">
  223.       <match extended="true">
  224.         (?<![\w\.])
  225.         ((\.[0-9]+|[0-9]+\.[0-9]*)([Ee][+-]?[0-9]*)?[FfDdMm]?|
  226.          ([0-9]+[Ee][+-]?[0-9]*)[FfDdMm]? |
  227.          ([0-9]+)[FfDdMm])
  228.         (?![\w\.])
  229.       </match>
  230.     </context>
  231.  
  232.     <!-- FIXME Taken from C, is it right? -->
  233.     <define-regex id="escaped-character" extended="true">
  234.       \\(                   # leading backslash
  235.       [\\\"\'nrbtfav\?] |   # escaped character
  236.       [0-7]{1,3} |          # one, two, or three octal digits
  237.       x[0-9A-Fa-f]+         # 'x' followed by hex digits
  238.       )
  239.     </define-regex>
  240.  
  241.     <context id="string" style-ref="string" end-at-line-end="true">
  242.       <start>"</start>
  243.       <end>"</end>
  244.       <include>
  245.     <context id="csharp-format" style-ref="format">
  246.           <match>{[0-9][0-9:\#\%,./cdefgnrxtsuDTFGMY]*}</match>
  247.         </context>
  248.         <context id="escaped-character" style-ref="escaped-character">
  249.           <match>\%{escaped-character}</match>
  250.         </context>
  251.         <context ref="def:line-continue"/>
  252.       </include>
  253.     </context>
  254.  
  255.     <context id="char" style-ref="char">
  256.       <!-- FIXME I don't know C# syntax -->
  257.       <match>'(\%{escaped-character}|.)'</match>
  258.     </context>
  259.  
  260.     <context id="c-sharp">
  261.       <include>
  262.         <context ref="multiline-string"/>
  263.         <context ref="string"/>
  264.         <context ref="char"/>
  265.         <context ref="line-comment"/>
  266.         <context ref="multiline-comment"/>
  267.         <context ref="close-comment-outside-comment"/>
  268.         <context ref="if-false-comment"/>
  269.         <context ref="preprocessor"/>
  270.         <context ref="keywords"/>
  271.         <context ref="primitives"/>
  272.         <context ref="null-value"/>
  273.         <context ref="boolean"/>
  274.         <context ref="decimal"/>
  275.         <context ref="hexadecimal"/>
  276.         <context ref="real"/>
  277.       </include>
  278.     </context>
  279.   </definitions>
  280. </language>
  281.